package com.sluggard.security.manage.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sluggard.common.model.res.Result;
import com.sluggard.mp.mvc.BaseController;
import com.sluggard.security.manage.model.entity.CodeEntity;
import com.sluggard.security.manage.model.req.CodingReq;
import com.sluggard.security.manage.service.ICodingService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* <p>
    * 系统码表 前端控制器
    * </p>
*
* @author lizheng
* @since 2024-04-28
*/
@Tag(name="系统码表")
@RestController
@RequestMapping("/manage/system/code")
public class CodingController  extends BaseController<CodingReq, CodeEntity, ICodingService> {

    @Override
    protected List<CodeEntity> onList(QueryWrapper<CodeEntity> queryWrapper) {
        return service.onList(queryWrapper);
    }

    @GetMapping("listByParentCode")
    public Result<List<CodeEntity>> listByParentCode(@RequestParam(value = "code") String code) {
        return Result.ok(service.listByParentCode(code));
    }

}
